package com.huawei.appgallery.foundation.ui.framework.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.foundation.service.common.protocol.AppListFragmentProtocol;
import com.huawei.appgallery.foundation.store.bean.detail.DetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse;
import com.huawei.appgallery.foundation.ui.framework.fragment.widget.SwitchTabListView;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.BaseTitleBean;
import com.huawei.appgallery.foundation.ui.framework.titleframe.bean.SpinnerInfo;
import com.huawei.appmarket.support.widget.title.spinner.bean.SpinnerTitleBean;
import com.huawei.secure.android.common.intent.SafeBundle;
import java.util.List;
import o.chd;
import o.chl;
import o.cia;
import o.ciq;
import o.cjd;
import o.cje;
import o.cjf;
import o.BaseRequest;
import o.AsyLoader;
import o.dgp;
import o.dky.h;
import o.dky.i;
import o.Logger;
import o.ContentManager;

public class SimpleListFragment extends AppListFragment<AppListFragmentProtocol> {
    private boolean ˊ = false;

    public void ˏ(Bundle bundle) {
        if (bundle != null) {
            this.ˊ = new SafeBundle(bundle).getBoolean("has_spinner_key");
        }
        super.ˏ(bundle);
    }

    public void ˋ(ViewGroup viewGroup, LayoutInflater layoutInflater) {
        ㆍॱ();
        ˏ(viewGroup);
        ˊ(viewGroup);
        ॱ(viewGroup);
        ᵔ();
    }

    public void ㆍॱ() {
        this.ॱˈ = (LinearLayout) this.ॱˍ.findViewById(h.ॱʽ);
        if (this.ॱˈ == null) {
            return;
        }
        if (this.ॱꞌ == null || !this.ॱꞌ.ˏ()) {
            ˋ(this.ॱᐧ);
            return;
        }
        this.ॱꞌ.ॱ();
        this.ॱˈ.addView(this.ॱꞌ.ˋ(), new LayoutParams(-1, -2));
    }

    public int ߵ() {
        if (ˈ() instanceof ciq) {
            return i.ʼॱ;
        }
        return i.ˈ;
    }

    public void ᵔ() {
        ˎ(this.ॱˍ);
        Fragment ˈ = ˈ();
        if (ˈ instanceof ciq) {
            boolean ॱ = ((ciq) ˈ).ॱ();
            boolean ˋ = ((ciq) ˈ).ˋ();
            String ˊ = ((ciq) ˈ).ˊ();
            String ae_ = ((ciq) ˈ).ae_();
            if (this.ͺˎ != null) {
                ((SwitchTabListView) this.ͺˎ).setTabInfo(ॱ, ˋ, ae_, ˊ);
            }
        }
    }

    public void ˋ(@NonNull Bundle bundle) {
        super.ˋ(bundle);
        new SafeBundle(bundle).putBoolean("has_spinner_key", this.ˊ);
    }

    public void ˊʼ() {
        super.ˊʼ();
        Fragment ˈ = ˈ();
        if (ˈ instanceof ciq) {
            ((ciq) ˈ).af_();
            if (this.ͺˎ != null) {
                this.ͺˎ.setSelection(0);
            }
        }
    }

    public void ʿॱ() {
        super.ʿॱ();
        Fragment ˈ = ˈ();
        if (ˈ instanceof ciq) {
            ((ciq) ˈ).ˏ();
        }
    }

    protected void ʻ(BaseDetailResponse<?> baseDetailResponse) {
    }

    protected void ॱॱ(BaseDetailResponse<?> baseDetailResponse) {
    }

    public void ˏ(BaseDetailResponse baseDetailResponse) {
        if (baseDetailResponse != null && ᐝॱ(baseDetailResponse.ˊᐝ())) {
            ˋ(ˋ(baseDetailResponse));
        }
    }

    public cje ˋ(BaseDetailResponse baseDetailResponse) {
        SpinnerInfo ˊˋ = baseDetailResponse.ˊˋ();
        if (ˊˋ != null) {
            baseDetailResponse.ॱ("only_spinner_title");
            cje ˋ = super.ˋ(baseDetailResponse);
            if (ˋ != null) {
                BaseTitleBean ˏ = ˋ.ˏ();
                if (ˏ instanceof SpinnerTitleBean) {
                    ((SpinnerTitleBean) ˏ).ˎ(ˊˋ);
                    this.ॱᶥ = true;
                    this.ˊ = true;
                    return ˋ;
                }
                this.ॱᶥ = false;
                this.ˊ = false;
            }
        }
        return null;
    }

    public void ˋ(cje o_cje) {
        if (this.ॱˈ == null) {
            return;
        }
        if (o_cje != null || this.ˊ) {
            ˎ(this.ॱˈ, 0);
            if (this.ॱꞌ != null) {
                this.ॱᐧ = o_cje;
                if (o_cje != null && o_cje.ˎ().equals(this.ॱꞌ.ᐝ())) {
                    this.ॱꞌ.ॱ(o_cje.ˏ());
                    return;
                }
            }
            ˎ(o_cje);
            return;
        }
        ˎ(this.ॱˈ, 8);
    }

    public void ˎ(cje o_cje) {
        if (this.ॱˈ != null) {
            cjf ˋ = cjd.ˋ(ॱˋ(), o_cje);
            if (ˋ == null) {
                ˎ(this.ॱˈ, 8);
                return;
            }
            ˋ.ॱ(this);
            if (ˋ.ˏ()) {
                ˋ.ॱ();
                if (this.ॱꞌ != null && this.ॱꞌ.ˏ()) {
                    this.ॱˈ.removeView(this.ॱꞌ.ˋ());
                    this.ॱꞌ.ॱॱ();
                }
                this.ॱᐧ = o_cje;
                this.ॱꞌ = ˋ;
                this.ॱˈ.removeAllViews();
                this.ॱˈ.addView(this.ॱꞌ.ˋ(), new LayoutParams(-1, -2));
                ˎ(this.ॱˈ, 0);
                return;
            }
            ˎ(this.ॱˈ, 8);
        }
    }

    public boolean ﹳॱ() {
        return false;
    }

    public boolean ॱﾞ() {
        return false;
    }

    public void ᐨॱ() {
    }

    public void ॱ(int i, int i2, Intent intent) {
    }

    public boolean ॱﹳ() {
        return false;
    }

    public boolean ॱꜞ() {
        return true;
    }

    public void ʹॱ() {
    }

    public List<dgp> ॱ(BaseDetailResponse baseDetailResponse) {
        return null;
    }

    public void ͺ(boolean z) {
    }

    public void ꜟॱ() {
        if (this.י instanceof chl) {
            BaseRequest ʼ = ((chl) this.י).ʼ();
            if (ʼ != null) {
                this.ʻᐝ = ʼ.getCacheID();
            }
            BaseDetailResponse ʻ = ((chl) this.י).ʻ();
            if (ʻ != null) {
                this.ॱᐧ = ˋ(ʻ);
                if (this.ॱꞌ == null && this.ॱᐧ != null && this.ॱᶥ) {
                    this.ॱꞌ = cjd.ˋ(ॱˋ(), this.ॱᐧ);
                    if (this.ॱꞌ != null) {
                        this.ॱꞌ.ॱ(this);
                    }
                }
            }
        }
    }

    public void ˎ(BaseDetailResponse baseDetailResponse) {
        if (baseDetailResponse != null && ᐝॱ(baseDetailResponse.ˊᐝ())) {
            ˊ(baseDetailResponse);
        }
    }

    public void ˊ(BaseDetailResponse baseDetailResponse) {
        this.ॱᐧ = ˋ(baseDetailResponse);
    }

    public void ˋ(List<dgp> list) {
    }

    public void ˋ(BaseRequest o_cvu, BaseDetailResponse baseDetailResponse) {
    }

    public void ᶥॱ() {
        ˎ(this.ͺˎ, 8);
        ˎ(this.ߴ, 8);
        if (this.ՙ != null) {
            this.ՙ.ˋ();
        }
        AsyLoader.ˋ(this.ʻᐝ);
    }

    public void ˋॱ(boolean z) {
        int i;
        int i2 = 8;
        View view = this.ͺˎ;
        if (z) {
            i = 0;
        } else {
            i = 8;
        }
        ˎ(view, i);
        View view2 = this.ߴ;
        if (!z) {
            i2 = 0;
        }
        ˎ(view2, i2);
    }

    public void ᶫ() {
        ˎ(this.ͺˎ, 8);
        ˎ(this.ߴ, 8);
    }

    public int ꜝ() {
        return 0;
    }

    public void ॱˋ(int i) {
    }

    public void ꜞॱ() {
        if (!ad_()) {
            ﾞॱ();
        } else if (Logger.ˎ()) {
            Logger.ˏ("SimpleListFragment", "onColumnReselected: is already OnTop and return ");
        }
    }

    public boolean ʻʼ() {
        return ad_();
    }

    public boolean ad_() {
        if (this.ͺˎ == null || ViewCompat.ˏ(this.ͺˎ, -1)) {
            return false;
        }
        return true;
    }

    protected void ˋʽ() {
        if (ʼʻ()) {
            if (this.י.ˊॱ() == 0 && !this.י.ᐝ()) {
                ˎ(this.ߴ, 0);
                if (this.ͺˎ != null) {
                    this.ͺˎ.setNeedFootView(false);
                }
            }
            this.ᶫ = System.currentTimeMillis();
            return;
        }
        ॱ(this.ᴵ);
        if (this.ʽ) {
            ʽᐝ();
        }
    }

    protected void ˊ(chd o_chd, DetailResponse<?> detailResponse) {
        this.ˊʼ = detailResponse.ˋ();
        this.ʽᐝ = detailResponse.ˋˊ();
        if (!TextUtils.isEmpty(detailResponse.ॱˋ())) {
            this.ʽˊ = detailResponse.ॱˋ();
        }
        ˋॱ(true);
        ˋ((BaseRequest) o_chd, (BaseDetailResponse) detailResponse);
        ˎ((BaseDetailResponse) detailResponse);
        cia ˊ = ˊ(ContentManager.getInstant().getContext());
        ˊ.ˎ(this.ʼˊ);
        this.ॱꜞ.ॱ(ˊ, o_chd, detailResponse, true);
        this.י = ˊ;
        if (this.ᐧॱ != null) {
            this.ᐧॱ.ˋ(this.ʼᐝ, ˊ);
        }
    }

    protected void ˏ(chd o_chd, DetailResponse detailResponse, boolean z) {
        ˋॱ(true);
        ॱ(o_chd);
        this.י.ˎ(this.ʼˊ);
        this.ॱꜞ.ॱ(this.י, o_chd, detailResponse, true);
        if (z && this.ˏ == 1) {
            this.ͺˎ.setSelection(0);
        }
        if ((this.י instanceof chl) && o_chd.ˏ() == 1) {
            chl o_chl = (chl) this.י;
            o_chl.ˎ(this.ʼˊ);
            o_chl.ˊ(detailResponse);
            o_chl.ॱ(o_chd);
        }
    }
}
